package com.jack.vipmis.vip.api.util;

import java.io.Serializable;
import java.util.Map;

import com.google.common.collect.Maps;

/**
 * 新版本的使用
 * 
 * @author JackLiang
 * @version 1.0
 * @date 2014-8-27
 */
public class MsgInfo implements Serializable {

	private static final long	serialVersionUID	= 1L;

	public static final int		ERROR_CODE			= 1005;
	public static final int		OK_CODE				= 1000;
	public static final String	ERROR_INFO			= "服务器异常，无法保存";

	/**
	 * 返回错误
	 * 
	 * @return
	 */
	public static Map<String, Object> fail() {
		Map<String, Object> dataMap = Maps.newHashMap();
		dataMap.put("info", ERROR_INFO);
		dataMap.put("status", ERROR_CODE);
		return dataMap;
	}

	/**
	 * 返回成功
	 * 
	 * @param obj
	 * @return
	 */
	public static Map<String, Object> ok(Object obj) {
		Map<String, Object> data = Maps.newHashMap();
		data.put("info", obj);
		data.put("status", OK_CODE);
		return data;
	}
}
